package by.exposit.dao;

import by.exposit.dao.entity.CommentEntity;
import by.exposit.domain.Project;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by HaRiA on 18.08.2014.
 */
 @Repository
 @Transactional
public class CommentDAOImpl extends GenericDAOImpl<CommentEntity,Long> implements CommentDAO {


    @Override
    public List<CommentEntity> listComments(Project project) {

                Criteria cr = getSession()
                .createCriteria(CommentEntity.class, "Comment")
                .add(Restrictions.eq("projectID", project));
        return cr.list();
    }
}
